/**
 * 
 */
package com.dovgopoly.carlogbook.common.mvp;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author Zhenya
 * 
 */
public abstract class AbstractView<P extends IPresenter> extends Composite implements IView<P> {

	/**
	 * A reference to the bound presenter implementation.
	 */
	protected P presenter;

	public void setPresenter(P presenter) {
		this.presenter = presenter;
	}

	public P getPresenter() {
		return presenter;
	}

	@Override
	public Widget asWidget() {
		return getWidget();
	}

	public void showErrorMessage(String errorMessage) {
		Window.alert(errorMessage);
	}

	public void showWarningMessage(String title, String warningMessage) {
		// new WarningBox(title, warningMessage).center();
		Window.alert(warningMessage);
	}
}
